﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace SampleApp
{
    class ViewModelPage2 : GalaSoft.MvvmLight.ViewModelBase, MvvmCrystalTool.INavigatableViewModel
    {
        public ViewModelPage2(MvvmCrystalTool.INavigationService nav)
        {
            GotoPage1 = new GalaSoft.MvvmLight.Command.RelayCommand(() =>
            {
                nav.Navigate(ViewModelLocator.Page1);
            });
        }

        public void OnNavigatedTo()
        {
            ++_visited;

            base.RaisePropertyChanged("Visited");
        }

        private int _visited = 0;
        public string Visited
        {
            get
            {
                return _visited.ToString(CultureInfo.InvariantCulture);
            }
        }

        public ICommand GotoPage1 { get; private set; }
    }
}
